<!DOCTYPE html>
<html lang="en" xmlns: xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8"/>
    <meta content="IE=Edge" http-equiv="X-UA-Compatible"/>
    <title>绑定网贷银行卡—小牛在线</title>
    <meta content="upgrade-insecure-requests" http-equiv="Content-Security-Policy">
    <link href="http://image.xiaoniu88.com/static/WebXn/dist/css/base-ddb0535420.css" rel="stylesheet"/>
    <script src="http://image.xiaoniu88.com/static/WebXn/dist/lib/base-6100562494.js" type="text/javascript"></script>
    <link rel="stylesheet" th:href="@{/css/base-ddb0535420 (1).css}"/>
    <script th:src="@{/layui/layer/layer.js}" type="text/javascript"></script>

    <script>
        window.global = {
            cdn: "//image.xiaoniu88.com",
            siteroot: "https://www.xiaoniu88.com",
            staticPath: "//image.xiaoniu88.com/static/WebXn/dist",
            contextPath: "/payment",
            serverTime: "1591919679692" * 1,
            userId: "6086292",
            isLogin: true
        }
    </script>

    <script src="//image.xiaoniu88.com/static/WebXn/dist/module/common/common-83987ed24e.js" type="text/javascript"></script>
    <script>
        $(function () {
            seajs.use('module/common/common')
        })
    </script>
    <link rel="stylesheet" th:href="@{/css/apply.css}"/>
    <link href="//image.xiaoniu88.com/static/WebXn/dist/page/payment/deposit/apply/css/apply-73c8a78781.css" rel="stylesheet"/>
</head>
<body>
<!--<div th:include="common/admin/common::common_footer_script"/>-->
<input id="em" th:value="${session.loanUsers.email}" type="hidden"/><!--th:value="${session.user.email}"-->
<input id="emcode" type="hidden"/>
<input id="checked" type="hidden"/><!--th:value="${session.applyType}"-->

<div class="affiche" id="afficheModel">

<span>小牛在线提醒您：为了更流畅的访问本网站，建议您使用IE9.0及以上版本浏览器或360浏览器。
	<a class="link" href="http://se.360.cn" rel="nofollow" target="_blank">点击进入360官网下载&gt;&gt;</a>
</span>
    <i class="icon-common icon-common-close"></i>
</div>
<div th:include="common/admin/common::common_footer_script"/>

<!--<header th:replace="/common::commonHeader"></header>

&lt;!&ndash;导航&ndash;&gt;
<div th:replace="/common::commonNav"></div>-->
<div class="row">
    <div th:replace="loan/public::head"></div>
</div>
<div class="container" style="width: 100%;">
    <div class="g-account-main">
        <div class="path">您现在的位置：我的账户 &gt;
            <span id="pathTitle">绑定网贷银行卡</span>
        </div>
        <div class="center user-box">

            <!--start 我的账户左边菜单列表--><!--th:replace="/user/AccountSafe::usersafe"-->
            <div th:replace="loan/alone/AccountOverview::inflist"/>
            <script src="//image.xiaoniu88.com/static/WebXn/dist/module/userNavList/js/init-09a2ab6833.js"></script>
            <script>
                $(function () {
                    seajs.use('module/userNavList/js/init');
                });
            </script>
            <!--end 我的账户左边菜单列表-->
            <input id="userNavList" type="hidden" value="bankCard">
            <!-- 左侧当前选中菜单 -->
            <div class="account-cont" id="contanier"><!--th:if="${session.applyType} eq apply"-->
                <div class="at-til">
                    <span class="name">绑定网贷银行卡</span>
                </div>
                <div class="bindcard-form" id="bindcardForm">
                    <div style="width: 697px">
                        <label>银行卡密码：</label>
                        <input class="bindcard-input" id="bankpwd" maxlength="6" name="name" onblur="checkUN()" style="width: 190px;height: 15px"
                               type="password"
                               value="">
                        <span class="bindcard-tip" id="unameMsg">请输入银行密码</span>
                    </div>
                    <div style="margin-right: 128px;">
                        <label>确认密码：</label>
                        <input class="bindcard-input" id="cfbankpwd" maxlength="6" name="idcard" onblur="checkIden()" style="width: 200px;height: 15px"
                               type="password"
                               value="">
                        <span class="bindcard-tip" id="iden">请再次输入密码</span>
                    </div>
                    <div class="js_code" style="margin-right: 230px;">
                        <label>邮箱验证码：</label>
                        <input class="bk_ipt bk_code" id="code" name="code" style="width: 80px;height: 15px" type="text">
                        <input class="btn-getcode" id="btnSendCode1" onClick="sendMessage1()" type="button" value="获取">
                        <span class="bindcard-tip" data-tip="" id="codeMsg"></span>
                    </div>
                    <div class="code_msg js_code"><!--th:text="${session.user.email}"-->
                        <span id="code_msg">验证码已发送到您的邮箱 <i>173****4231</i></span>
                    </div>
                    <button class="bind-btn" onclick="bind()" style="background-color: #658297;margin-left: 259px;" type="button" value="立即绑定">立即绑定</button>
                </div>
                <!--<dl class="bindcard-tips"> <dt>温馨提示</dt>
                    <dd>
                        1、银行卡的开户名必须与实名登记的姓名一致； <br>
                        2、为了您的资金安全，仅限绑定一张银行卡；仅支持储蓄卡，不可用信用卡；<br>
                        3、更改绑定银行卡，需要提交个人证明材料进行人工审核；如有其它问题咨询，请联系客服。
                    </dd>
                </dl>-->
            </div>
        </div>
        <div class="g-h30"></div>
    </div>
</div>
<!--end 内容-->


<script src="//image.xiaoniu88.com/static/WebXn/dist/page/payment/deposit/apply/js/apply-ea73681945.js"></script>
<script>
</script>


<div class="row">
    <!--网站底部-->
    <div th:replace="common/public::footer"></div>
</div>

<!--end 尾部-->

<!--引入统计代码-->

<div style="display:none">
    <script>
        (function (i, s, o, g, r, a, m) {
            i['GoogleAnalyticsObject'] = r;
            i[r] = i[r] || function () {
                (i[r].q = i[r].q || []).push(arguments)
            }, i[r].l = 1 * new Date();
            a = s.createElement(o),
                m = s.getElementsByTagName(o)[0];
            a.async = 1;
            a.src = g;
            m.parentNode.insertBefore(a, m)
        })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');

        ga('create', 'UA-104712537-1', 'auto');
        ga('send', 'pageview');

    </script>
</div>

<script type="text/javascript">
    $(window).bind("load", function () {
        $("#abc").css("background", "#658297");
        $("#colorabc").css("color", "#fff");
    });
    var couldsub = false;
    var jishi = 59;
    var jishuTishi;
    var yhMa;

    //邮箱验证码
    var count = 60; //设置每次验证码的有效时间，间隔函数，1秒执行
    var InterValObj1; //timer变量，控制时间
    var curCount1;//当前剩余秒数
    var random = Math.floor(Math.random() * (1000 - 9999)) + 9999;//产生四位随机数
    /*第一*/
    function sendMessage1() {
        curCount1 = count;
        var em = $.trim($('#em').val());
        /*if (!emailreg.test(em)) {
            alert(" 请输入有效的邮箱地址");
            return false;
        }*/
        random = Math.floor(Math.random() * (1000 - 9999)) + 9999;//第二次及以后每点击一次发送，都重新赋值 否则random为null
        var myEmail = $('#em').val();
        sendEmail(random, myEmail);//发送邮件
        //设置button效果，开始计时
        $("#btnSendCode1").attr("disabled", "true");
        $("#btnSendCode1").val(+curCount1 + "秒再获取");
        InterValObj1 = window.setInterval(SetRemainTime1, 1000); //启动计时器，1秒执行一次
        //向后台发送处理数据
    }

    //剩余时间显示
    function SetRemainTime1() {
        if (curCount1 == 0) {
            window.clearInterval(InterValObj1);//停止计时器
            $("#btnSendCode1").removeAttr("disabled");//启用按钮
            $("#btnSendCode1").val("重新发送");
            random = '';//时间到了，清空验证码的值
        } else {
            curCount1--;
            $("#btnSendCode1").val(+curCount1 + "秒再获取");
        }
    }

    function addbank() {
        $.post("[[@{/loan/Personal/updbankst}]]", {}, function (data) {
        }, 'text');
    }

    function delbank() {
        var msg = "您真的确定要删除吗？";
        if (confirm(msg) == true) {
            var delid = $("#tonys").attr("value");
            let i = layer.msg(delid);
            layer.style(i, {
                'background-color': 'lightgray'
            });
            /*$.post("[[@{/Personal/delbankst}]]",{
                id : delid
            }, function (data) {
                window.location.replace("[[@{/Personal/preapply}]]")
            },'text');*/
        } else {
            return false;
        }


    }

    function sendEmail(emailcode, myEmail) {
        $.ajax({
            url: "[[@{/loan/Personal/sendEmail}]]",
            data: {"emailcode": emailcode, "myEmail": myEmail},
            type: "POST",
            success: function (data) {
                if (data > 0) {
                    let i = layer.msg('邮件已经发送到您的邮箱，请注意查收', {time: 1300});
                    layer.style(i, {
                        'background-color': 'lightgray'
                    });
                } else {
                    let i = layer.msg('邮件未发送成功，请联系管理员', {time: 1300});
                    layer.style(i, {
                        'background-color': 'lightgray'
                    });
                }
            },
            error: function () {
                let i = layer.msg('服务器繁忙，请稍后再试！', {time: 1300});
                layer.style(i, {
                    'background-color': 'lightgray'
                });
            },
            dataType: "json"
        });
    }


    function checkUN() {
        var uName = $("#bankpwd").val();
        if (uName != null || uName != "") {
            $("#unameMsg").replaceWith("<span class=\"bindcard-tip\" style='width: 96px' id=\"unameMsg\">密码为6位数哦</span>");
        }
    }

    function checkIden() {
        var idpwd = $("#cfbankpwd").val();
        var idpwds = $("#bankpwd").val();
        if (idpwd == null || idpwd == "") {
            $("#iden").replaceWith("<span class=\"bindcard-tip\" id=\"iden\" data-tip=\"请输入身份证号码\">请再输入密码</span>");
        } else if (idpwd != null || idpwd != "") {
            if (idpwd != idpwds) {
                $("#iden").replaceWith("<span class=\"bindcard-tip errTip\" id=\"iden\">密码必须相同</span>");
            }
        }
    }

    function checkCid() {
        var cardId = $("#cid").val();
        if (cardId == null || cardId == "") {
            $("#cidmsg").replaceWith("<span class=\"bindcard-tip\" id=\"cidmsg\">仅支持储蓄卡</span>");
        }
    }

    function checkBn() {
        var bankName = $("#bankName").val();
        if (bankName == null || bankName == "") {
            $("#bn").replaceWith("<span class=\"bindcard-tip\" id=\"bn\"></span>");
        }
    }

    function bind() {
        couldsub = true;
        var uName = $("#bankpwd").val();
        var identity = $("#cfbankpwd").val();

        /*var arge = $("#arge").val();*/
        var code = $("#code").val();

        if (identity == null || identity == "") {
            couldsub = false;
            $("#iden").replaceWith("<span class=\"bindcard-tip errTip\" style='width: 140px' id=\"iden\">该选项不能为空！</span>");
        } else {
            if (identity != uName) {
                $("#iden").replaceWith("<span class=\"bindcard-tip errTip\" id=\"iden\">密码必须一致</span>");
            }
            couldsub = false;
        }
        if (uName == null || uName == "") {
            couldsub = false;
            $("#unameMsg").replaceWith("<span class=\"bindcard-tip errTip\" style='width: 140px' id=\"unameMsg\">该选项不能为空！</span>");
        } else if (code != random) {
            let i = layer.msg('无效的验证码');
            layer.style(i, {
                'background-color': 'lightgray'
            });
            couldsub = false
        } else {
            couldsub = true
        }
        if (couldsub == true) {
            $.post("[[@{/loan/Personal/applyupdpwd}]]", {
                uName: uName,
            }, function (data) {
                let i = layer.msg("设置" + data);
                layer.style(i, {
                    'background-color': 'lightgray'
                });
                window.location.replace("[[@{/loan/Personal/preSafe}]]")
            }, 'text');
        }
    }
</script>
<script>
</script>
</body>
</html>